#include "MasteTestClient.hpp"

#include "cybertron/core/UtilFile.hpp"
#include "cybertron/core/UtilString.hpp"


int main(int argc, char* argv[])
{


	MasterTestClient client;
	
	client.initialize(argc, argv);
	//getchar();
	printf("======>wait logon\n");
	while (1)
	{
		if (!client.isLogon()) {
			std::this_thread::sleep_for(std::chrono::milliseconds(100));
			continue;
		}
		break;
	}
	
	//client.sendCommand2Agent();
	//run test
	client.sendTaskProAllocate();
	//
	while (true)
	{
		
		bool b = client.isCanSendTask();
		if (b) {
			printf("======>now may be send task \n");
			break;
		}
		
		std::this_thread::sleep_for(std::chrono::milliseconds(1000));
	}
	//getchar();
	printf("======>wait send task\n");
	client.sendTaskStart();

	printf("======>wait task stop.....\n");
	getchar();

	

	client.sendTaskStop();

	while (true)
	{
		printf("======>wait .....\n");
		getchar();
		client.sendTaskStop();
	}
	return 0;
}